home *** CD-ROM | disk | FTP | other *** search
/ MacTech 1 to 12 / MacTech-vol-1-12.toast / Source / MacTech® Magazine / Volume 03 - 1987 / 03.05 May 87 / basic windows / WINDOW.BAS next >
Encoding:
BASIC Source File  |  1987-03-12  |  1.3 KB  |  45 lines  |  [TEXT/MSBB]

  1. 'WIND Resource Demo
  2. '©MacTutor™ 1987
  3. 'By Dave Kelly
  4.  
  5. Libname$="Hard Disk:Basic:MS ToolLib:ToolLib"  ' full Library file name
  6. LIBRARY Libname$
  7. WINDResname$="Hard Disk:MacTutor™:May87:Window.rsc" 'full resource name
  8. WIDTH 40
  9. DIM a(40)
  10. FOR i=1 TO 4
  11. ID%=3040+i
  12. CALL GetResWindow(WINDResname$,ID%,top,left,bottom,right,ProcID,TitleLength,Title$)
  13. type=1
  14. IF ProcID= 0 THEN type=1
  15. IF ProcID=1 THEN type=2
  16. IF ProcID=2 THEN type=3
  17. IF ProcID=3 THEN type=4
  18. WINDOW i,Title$,(left,top)-(right,bottom),type
  19. PRINT "Top= ";top,"Left= ";left,"Bottom= ";bottom,"Right= ";right
  20. PRINT "ProcID = ";ProcID
  21. PRINT "TitleLength = ";TitleLength
  22. PRINT "Title = ";Title$
  23. PRINT "Click mouse to continue"
  24. WHILE MOUSE(0)<>1:WEND
  25. NEXT i
  26. END
  27.  
  28. SUB GetResWindow (WINDResname$,ID%,top,left,bottom,right,ProcID,TitleLength,Title$) STATIC
  29. ref%=0
  30. type$="WIND"
  31. openresfile WINDResname$,ref%
  32. loadArray ref%,ID%,a(1),type$
  33. top=PEEK(VARPTR(a(1)))*256+PEEK(VARPTR(a(1))+1)
  34. left=PEEK(VARPTR(a(1))+2)*256+PEEK(VARPTR(a(1))+3)
  35. bottom=PEEK(VARPTR(a(1))+4)*256+PEEK(VARPTR(a(1))+5)
  36. right=PEEK(VARPTR(a(1))+6)*256+PEEK(VARPTR(a(1))+7)
  37. ProcID=PEEK(VARPTR(a(1))+8)*256+PEEK(VARPTR(a(1))+9)
  38. TitleLength=PEEK(VARPTR(a(1))+18)
  39. closeResFile ref%
  40. Title$=""
  41. FOR i=1 TO TitleLength
  42.     Title$=Title$+CHR$(PEEK(VARPTR(a(1))+i+18))
  43. NEXT
  44. END SUB
  45.